package factory

type FactoryWrapper struct {
}

func NewFactoryWrapper() *FactoryWrapper {
	return &FactoryWrapper{}
}

func (this *FactoryWrapper) RegisterCreator(id string, fn func(...any) (any, error)) error {
	return RegisterFactoryCreateFunc(id, fn)
}

func (this *FactoryWrapper) UnregisterCreator(id string) {
	UnregisterFactoryCreateFunc(id)
}
func (this *FactoryWrapper) Create(id string, args ...any) (any, error) {
	return CreateFactoryInstance(id, args...)
}

func (this *FactoryWrapper) RegisterVar(id string, val any) error {
	RegisterFactoryVar(id, val)
	return nil
}

func (this *FactoryWrapper) GetVar(id string) any {
	return GetFactoryVar(id)
}

func (this *FactoryWrapper) RemoveVar(id string) {
	RemoveFactoryVar(id)
}

func (this *FactoryWrapper) RangeVarList(cb func(val any) bool) {
	RangeFactoryVarList(cb)
}

func (this *FactoryWrapper) RangeVarKVList(cb func(key string, val any) bool) {
	RangeFactoryVarListEx(cb)
}
